import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;

import etxt2db.api.ClassificationExecutor;
import etxt2db.api.ClassificationModel;
import etxt2db.api.ClassificationModelCreator;
import etxt2db.features.CharacterFeatureClassifier;
import etxt2db.features.EditableTokenFE;
import etxt2db.features.ValueCaseInsensitiveFeatureClassifier;
import etxt2db.features.ValueCaseSensitiveFeatureClassifier;




public class TestePerguntas {
	
	public static void main(String[] args) throws IOException, ParseException{
		
		List<CharacterFeatureClassifier> features = new ArrayList<CharacterFeatureClassifier>();
		features.add(new ValueCaseInsensitiveFeatureClassifier());
		features.add(new ValueCaseSensitiveFeatureClassifier());
		//features.add(new AnnotatedDocumentFeatureClassifier("NP"));
		EditableTokenFE featureExtractor = new EditableTokenFE(features,0);
		
		ClassificationModelCreator trainer = new ClassificationModelCreator();
		
		trainer.setDocPerFile(false);
		
		List<String> types = new ArrayList<String>();
		types.add("obra");
		
		File trainingFile = new File("./resources/Xana/treino");
		
		File testingFile = new File("./resources/Xana/teste/teste_pinturas.txt");
		
		ClassificationModel an = trainer.trainMachineLearningModel(trainingFile, ClassificationModelCreator.MLTechnique.SVM, types,featureExtractor);
		
		ClassificationExecutor tester = new ClassificationExecutor();
		tester.setDocPerFile(false);
		
		System.out.println(tester.getClassifiedSegments(testingFile, an, types));
		//System.out.println(tester.getAnnotatedContent(testingFile, an, types));
		
		/*List<CharacterFeatureClassifier> features1 = new ArrayList<CharacterFeatureClassifier>();
		features1.add(new AnnotationModelFeatureClassifier(an));
		features1.add(new AnnotatedDocumentFeatureClassifier("NP"));
		EditableTokenFE featureExtractor1 = new EditableTokenFE(features1,0);
		
		trainer.trainModel(trainingFile, ClassificationTechnique.MLTechnique.CRF, types,featureExtractor1);
		System.out.println(tester.getAnnotatedContent(testingFile, an, types));*/
	}
}
